-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a command line argument to set the logConfiguration #731
Conversation
First cut of configuring the ``--log-driver`` for from Empire. Details of this are listed in #704. In short, this allows controlling the logging driver when Empire starts up. Work remaining to do: - validate the values passed in on the command line - add support for log options
FlagDockerSocket = "docker.socket" | ||
FlagDockerCert = "docker.cert" | ||
FlagDockerAuth = "docker.auth" | ||
FlagDockerLogDriver = "docker.logdriver" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should actually live under the ecs.*
namespace. The docker.*
flags control options for connecting to the local docker daemon.
Awesome, other than those comments and tests, this looks like a good first step. It'd be nice if we could also provide a way to pass log driver options, but I don't think it's necessary for the first version. |
Change the visibility/scope of `Config` and instead deal with `ecs.logConfiguration` in the places which need it. Also add support to accept multiple `ecs.logopt` fields which end up in the docker `--log-opt` arguments.
cli.StringSliceFlag{ | ||
Name: FlagECSLogOpts, | ||
Value: &cli.StringSlice{}, | ||
Usage: "Log driver to options. Maps to the --log-opt docker cli arg", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give an example of the format you'd pass here? I'd assume tag=foo,thing=bar
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logopt
takes multiple arguments, which is exactly how it works with docker run
:
empire server --ecs.logdriver syslog --ecs.logopt tag=brianz --ecs.logopt syslog-facility=daemon
...results in:
"LogConfig": {
"Type": "syslog",
"Config": {
"syslog-facility": "daemon",
"tag": "brianz"
}
},
This makes it more obvious what's running in the list of EC2 instances
Also add some validation around the log driver options. Restrict to syslog and json-file for now since the other options would have other consequences which aren't fully tested.
Awesome, this looks good to me. If you can rebase on top of master I'll go ahead and merge. 👍 |
Conflicts: .gitignore
Rebasing was pretty gnarly so I merged in master. Thanks again for the guidance @ejholmes. |
Add a command line argument to set the logConfiguration
First cut of configuring the
--log-driver
for from Empire. Details of this are listed in #704.In short, this allows controlling the logging driver when Empire starts up. Work remaining to do:
I tested this and it's working as expected when using
empire server --docker.logdriver syslog
I'd appreciate any feedback since this is my first time in Go.